<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:include="fragments/include::header">
</head>
<head>
    <link th:href="@{/static/css/plugins/bootstrap-table/bootstrap-table.css}" rel="stylesheet"/>
    <link th:href="@{/static/css/plugins/autocompleter/jquery.autocompleter.css}" rel="stylesheet"/>
    <link th:href="@{/static/css/plugins/datetimepicker/bootstrap-datetimepicker.min.css}" rel="stylesheet"/>
    <link th:href="@{/static/css/plugins/pickList/pickList.css}" rel="stylesheet"/>
    <link th:href="@{/static/css/plugins/iCheck/custom.css}" rel="stylesheet"/>
    <link th:href="@{/static/css/plugins/bootstrap-table/extensions/editable/bootstrap-editable.css}" rel="stylesheet"/>

    <script th:src="@{/static/js/plugins/bootstrap-table/bootstrap-table.js}"></script>
    <script th:src="@{'/static/js/plugins/bootstrap-table/locale/bootstrap-table-'+${#locale.language}+'.min.js'}"></script>
    <script th:src="@{/static/js/plugins/autocompleter/jquery.autocompleter.min.js}"></script>
    <script th:src="@{/static/js/plugins/datetimepicker/bootstrap-datetimepicker.min.js}"></script>
    <script th:src="@{/static/js/plugins/datetimepicker/locale/bootstrap-datetimepicker.zh_CN.js}"></script>
    <script th:src="@{/static/js/plugins/validate/jquery.validate.min.js}"></script>
    <script th:src="@{'/static/js/plugins/validate/messages_'+${#locale.language}+'.min.js'}"></script>
    <script th:src="@{/static/js/plugins/bootstrap-table/extensions/export/bootstrap-table-export.js}"></script>
    <script th:src="@{/static/js/plugins/bootstrap-table/extensions/export/tableExport.js}"></script>
    <script th:src="@{/static/js/plugins/bootstrap-table/extensions/export/libs/js-xlsx/xlsx.core.min.js}"></script>
    <script th:src="@{/static/js/plugins/bootstrap-table/extensions/export/libs/FileSaver/FileSaver.min.js}"></script>
    <script th:src="@{/static/js/plugins/pickList/pickList.js}"></script>
    <script th:src="@{/static/js/plugins/iCheck/icheck.min.js}"></script>
    <script th:src="@{/static/js/plugins/bootstrap-table/extensions/editable/bootstrap-table-editable.min.js}"></script>
    <script th:src="@{/static/js/plugins/bootstrap-table/extensions/editable/bootstrap-editable.min.js}"></script>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="form-horizontal">
                <div class="form-group">
                    <div class="col-sm-9">
                        <button class="btn btn-primary" style="width: 100px;float: left;" onclick="add()">
                            <i class="fa fa-plus"></i>&nbsp;<span th:text="#{sys.add}">添加</span>&nbsp;
                        </button>
                    </div>

                </div>
                <label class="control-label" id="comConfigInfo"></label>
                <table id="table" class="table-striped" data-mobile-responsive="true"></table>
            </div>
        </div>
    </div>
</div>
<div class="modal fade" id="addModal">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <form class="form-horizontal" id="addForm">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                    <h3 class="modal-title" id="add_h3">添加</h3>
                    <h3 class="modal-title" id="edit_h3">修改</h3>
                </div>
                <div class="modal-body" id="addadd">
                    <input type="hidden" name="configId" id="configId" value=""/>
                    <div class="form-group">
                        <label class="col-sm-3 control-label" >周期天数</label>
                        <div class="col-sm-7">
                            <input type="number" name="periodDay" id="periodDay" class="form-control"
                                   onchange="addTable('' , '')" required="required"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">活动类型</label>
                        <div class="col-sm-7">
                            <select class="form-control" name="type" id="type">
                                <option value="aBankrupt">救济金</option>
                                <option value="aSeven">七天登录</option>
                                <option value="freeMatch">免费对局</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label" >每日刷新时间</label>
                        <div class="col-sm-7">
                            <select class="form-control" name="clearHour" id="clearHour">
                                <optgroup label="上午" >
                                    <option value="0">0时</option>
                                    <option value="1">1时</option>
                                    <option value="2">2时</option>
                                    <option value="3">3时</option>
                                    <option value="4">4时</option>
                                    <option value="5">5时</option>
                                    <option value="6">6时</option>
                                    <option value="7">7时</option>
                                    <option value="8">8时</option>
                                    <option value="9">9时</option>
                                    <option value="10">10时</option>
                                    <option value="11">11时</option>
                                    <option value="12">12时</option>
                                </optgroup>
                                <optgroup label="下午">
                                    <option value="13">13时</option>
                                    <option value="14">14时</option>
                                    <option value="15">15时</option>
                                    <option value="16">16时</option>
                                    <option value="17">17时</option>
                                    <option value="18">18时</option>
                                    <option value="19">19时</option>
                                    <option value="20">20时</option>
                                    <option value="21">21时</option>
                                    <option value="22">22时</option>
                                    <option value="23">23时</option>
                                </optgroup>


                            </select>
<!--                            <input type="text" id="clearHour" name="clearHour" class="form-control" required/>-->
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label" >活动开始时间</label>
                        <div class="col-sm-7">
                            <input type="text" id="startTime" name="startTime" class="form-control" required/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">活动结束时间</label>
                        <div class="col-sm-7">
                            <input type="text" id="endTime" name="endTime" class="form-control" required/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">是否开启</label>
                        <div class="col-sm-7">
                            <div class="col-sm-3">
                                <select class="form-control" name="enable" id="enable">
                                    <option value="true">开启</option>
                                    <option value="false">关闭</option>
                                </select>
                            </div>
                        </div>
                    </div>

                </div>
                <div class="modal-footer">
                    <button type="submit" class="btn btn-primary" th:text="#{sys.save}">保存</button>
                </div>
            </form>
        </div>
    </div>
</div>
</body>
<script type="text/javascript" th:inline="javascript">
    /*<![CDATA[*/
    table = $("#table");
    var currencyTypes = [];
    var curreneyData = {};
    var otherAwardTypes = [];
    var otherAwardData = {};
    typeData = {};

    $(function () {
        initData();
        initTable();

        loadDateTimePicker();
        // initCurreney();
    });
    //加载日历选择器
    function loadDateTimePicker() {
        let date = new Date();
        $("#startTime").datetimepicker({
            language: 'zh-CN',
            format:'yyyy-mm-dd hh:ii:00',
            // minuteStep: 1,
            // value: date, //当前值，设置之后就覆盖
            // weekStart: 1,
            todayBtn:  1,
            autoclose: 1,//自动关闭
            todayHighlight: 1,
            startView: 2,//起始年月日页面
            minView: 0,
            maxView: 1,
            forceParse: 1,//强制解析
        })
        $("#endTime").datetimepicker({
            language: 'zh-CN',
            format:'yyyy-mm-dd hh:ii:00',
            // minuteStep: 1,
            // value: date, //当前值，设置之后就覆盖
            // weekStart: 1,
            todayBtn:  1,
            autoclose: 1,//自动关闭
            todayHighlight: 1,
            startView: 2,//起始年月日页面
            minView: 0,
            maxView: 1,
            forceParse: 1,//强制解析
        })
    }
    function initData() {
        otherAwardData["vip"] = [[#{activity.signIn.vip}]];
        otherAwardData["monthCard"] = [[#{activity.signIn.monthCard}]];

        $.each(otherAwardData, function (key, value) {
            otherAwardTypes.push({
                value: key,
                text: value,
            });
        })

        typeData["aBankrupt"] = "救济金";
        typeData["aSeven"] = "七天登录";
        typeData["freeMatch"] = "免费对局";
    }

    // function initCurreney() {
    //     gameAjax({
    //         url: "/activity/inviteConfig/initCurrency",
    //         async: false,
    //         callback: function (data) {
    //             curreneyData = data;
    //             $.each(data, function (key, val) {
    //                 currencyTypes.push({value: key, text: val})
    //             });
    //         }
    //     });
    // }


    function search() {
        table.bootstrapTable("refresh");
    }

    function initTable() {
        $("#table").bootstrapTable({
            ajax: function (params) {
                gameBootstrapTable("/activity/sevenSignInConfig/list", params);
            },
            queryParams: function (params) {
                var query = {
                    limit: params.limit,
                    offset: params.offset,
                    order: params.order,
                    // sort: params.sort
                };
                return query;
            },
            pagination: true,
            singleSelect: false,
            idField: "configId",
            uniqueId: "configId",
            sidePagination: "server",
            columns: [
                // {
                //     title: ['活动ID'],
                //     field: "configId",
                //     width: "7%",
                //     align: "center"
                // },
                {
                    title: ['周期天数'],
                    field: "periodDay",
                    align: "center",
                    width: "4%",
                    sortable: true
                },
                {
                    title: ['活动类型'],
                    field: "type",
                    align: "center",
                    width: "8%",
                    formatter: function (val) {
                        return typeData[val];
                    }
                },
                {
                    title: ['起始时间'],
                    field: "startTime",
                    align: "center",
                    width: '13%',
                    formatter: function (value) {
                        return  new Date(value).format("yyyy-MM-dd hh:mm:ss");
                    }
                },
                {
                    title: ['结束时间'],
                    field: "endTime",
                    align: "center",
                    width: '13%',
                    formatter: function (value) {
                        return  new Date(value).format("yyyy-MM-dd hh:mm:ss");
                    }
                },
                {
                    title: ['是否启用'],
                    field: "enable",
                    align: "center",
                    width: "4%",
                    formatter: function (val) {
                        return val ? "是" : "否"
                    }
                },
                {
                    title: ['每天刷新时间'],
                    field: "clearHour",
                    align: "center",
                    width: '7%',
                    formatter: function (value) {
                        return value+'时';
                    }
                },
                {
                    title: ['每日奖励'],
                    field: "daysAwards",
                    align: "center",
                    width: '25%',
                    formatter: function (value) {
                        var result = "";
                        for (var i in value) {
                            var award = value[i];
                            result += "第"+ (parseInt(i)+1) +"天：";

                            for(var j in award) {
                                var cur = award[j].itemId;
                                var count = award[j].count;
                                if(cur === "gold"){
                                    result += count + '金币';
                                }else if(cur === 'chip'){
                                    result += count + '点券';
                                }
                                result += "\t";
                            }
                            result += "</br>";
                        }
                        return result;
                    }
                },
                {
                    title: [[#{sys.operate}]],
                    field: "configId",
                    align: "center",
                    formatter: function (value, rowData) {
                        // alert(value);
                        var formatter = '<div class="btn-group hidden-xs"><button type="button" class="btn btn-xs btn-primary" onclick="edit(\'' + value + '\')" th:text="#{sys.edit}">编辑</button>';
// 	                	if(rowData.enable){
// 							formatter += '&nbsp;<button type="button" class="btn btn-xs btn-warning" onclick="changeStatus(\'' + value + '\')"  th:text="#{sys.unenable}">关闭</button>';
// 						}else{
// 							formatter += '&nbsp;<button type="button" class="btn btn-xs btn-info" onclick="changeStatus(\'' + value + '\')"  th:text="#{sys.enable}">开启</button>';
// 						}
                        formatter += '<button type="button" class="btn btn-xs btn-danger" onclick="del(\'' + value + '\')"  th:text="#{sys.delete}">删除</button>';
                        return formatter;
                    }
                }
            ]
        });
    }
save = false;
    function add() {
        save = true;
        for(var i = oldNum ; i> 0 ; i--){
            delete rowNumbers['rowNumber' + i]; //删除指定属性
            // rowNumbers['rowNumber' + i];
            $("#tableInput"+i+"").remove();
        }
        oldNum = 0;
        $("#edit_h3").hide();
        $("#add_h3").show();
        $("#addForm")[0].reset();
        formValidate('');
        // $("#id").val(null);
        // loadAwardConf("");
        // loadAwardConf1("");
        // loadAwardConf2("");
        // loadAwardConf3("");
        // loadOtherAwardConf("");

        // $("#addadd").append("     <div class=\"form-group\">\n" +
        //     "                        <label class=\"col-sm-3 control-label\">奖励</label>\n" +
        //     "                        <div class=\"col-sm-7\">\n" +
        //     "                            <div class=\"btn-group hidden-xs\" id=\"awardConfBar\">\n" +
        //     "                                <button type=\"button\" class=\"btn btn-sm btn-info\" onclick=\"addAwardConf();\">\n" +
        //     "                                    <i class=\"glyphicon glyphicon-plus\" aria-hidden=\"true\"></i>&nbsp;<span\n" +
        //     "                                        th:text=\"#{sys.add}\">添加</span>\n" +
        //     "                                </button>\n" +
        //     "                                <button type=\"button\" class=\"btn btn-sm btn-info\" onclick=\"addAwardConf2();\">\n" +
        //     "                                    <i class=\"glyphicon glyphicon-plus\" aria-hidden=\"true\"></i>&nbsp;<span>添加2</span>\n" +
        //     "                                </button>\n" +
        //     "                            </div>\n" +
        //     "                            <table class=\"table table-striped\" id=\"awardTable\"></table>\n" +
        //     "                            <table class=\"table table-striped\" id=\"awardTable2\"></table>\n" +
        //     "                        </div>\n" +
        //     "                    </div>");
        // // $("#addForm").append(input);

        $("#addModal").modal("show");
    }
    var oldNum = 0;
    function addTable(id , daysAwardsLength){
        // alert(oldNum);
        var num = $("#periodDay").val();

        if(num < 0 || num >= 50) return;
        var diff =  num - oldNum;
        // alert(diff);
        if(diff > 0){ //增加
            // diff += num;
            for(var i = parseInt(oldNum)+1 ; i <= num ; i++){
                rowNumbers['rowNumber' + i] = 1;
            }
            // alert(variables['rowNumber' + 3]); //成功

            for(var i = parseInt(oldNum)+1 ; i <= num ; i++){

                $("#addadd").append("     <div class=\"form-group\" id=\"tableInput"+i+"\">\n" +
                    "                        <label class=\"col-sm-3 control-label\">第"+i+"天奖励</label>\n" +
                    "                        <div class=\"col-sm-7\">\n" +
                    "                            <div class=\"btn-group hidden-xs\" id=\"awardConfBar"+i+"\">\n" +
                    "                                <button type=\"button\" class=\"btn btn-sm btn-info\" onclick=\"addAwardConfx(\'rowNumber"+i+"\' , \'awardTable"+i+"\');\">\n" +
                    "                                    <i class=\"glyphicon glyphicon-plus\" aria-hidden=\"true\"></i>&nbsp;<span\n" +
                    "                                        th:text=\"#{sys.add}\">添加</span>\n" +
                    "                                </button>\n" +
                    "                            </div>\n" +
                    "                            <table class=\"table table-striped\" id=\"awardTable"+i+"\"></table>\n" +
                    "                        </div>\n" +
                    "                    </div>");

                    loadAwardConfx("" , "" , "awardTable"+i+"","awardConfBar"+i+"");
            }
        }else if(diff < 0){ //减
            for(var i = parseInt(oldNum) ; i > parseInt(num) ; i--){
                // console.log(oldNum);
                delete rowNumbers['rowNumber' + i]; //删除指定属性
                // rowNumbers['rowNumber' + i];
                // $("#tableInput"+i+"").remove();
                $("#tableInput"+i).remove();
            }
        }
        editView(id , daysAwardsLength); //回显
        oldNum = num;
        // alert('oldNum'+oldNum);
    }
    isUpdate = false;
    function edit(id) {
        // console.log(awardTableTe);
        // console.log(typeof(awardTableTe));
        if( !$.isEmptyObject(awardTableTe) && awardTableTe.configId === id && isUpdate === false ){  //不更新

        }else{ //更新
            var te = table.bootstrapTable('getRowByUniqueId', id);
            awardTableTe = [];

            // $.extend(true , awardTableTe , te);
            awardTableTe = te;
        }
       console.log(awardTableTe);
       isUpdate = false;
        save = false;
        // alert('edit'+id);
        $("#edit_h3").show();
        $("#add_h3").hide();
        $("#addForm")[0].reset();
        formValidate(id);
        var data = table.bootstrapTable('getRowByUniqueId', id);
        // console.log(data);
        $.each(data, function (id, val) {
            $("#" + id).val(String(val));
        });
        //jquery操作select(取值，设置选中）
        $("#type").find(`option[value = "typeData[data.type]"]`).attr("selected",true);
        $("#clearHour").find(`option[value = "data.clearHour"]`).attr("selected",true);
        // $("#clearHour").val(new Date(data.clearHour).format("hh:mm:00"));
        $("#enable").find(`option[value = "data.enable"]`).attr("selected",true);
        $("#configId").val(id);

        $("#startTime").val(new Date(data.startTime).format("yyyy-MM-dd hh:mm:ss"));
        $("#endTime").val(new Date(data.endTime).format("yyyy-MM-dd hh:mm:ss"));
        // loadAwardConf(id);
        // loadAwardConfx(id);
        // loadOtherAwardConf(id);
        addTable(id , data.periodDay);
        $("#addModal").modal("show");
        // alert(data.daysAwards.length);

    }


    function formValidate(configId) {

        $("#addForm").validate({
            submitHandler: function (form) {
                onSave(configId);
            }
        }).resetForm();
    }

    function onSave(configId) {

        if(save){
            $("#configId").val("");
        }else{
            isUpdate = true;   // 修改标识
        }
        // alert('保存'+configId);
       var awardAllDays = [];
        for(var i= 1 ; i <= oldNum ; i++){
            awardAllDays.push($("#awardTable"+i+"").bootstrapTable("getData"));
        }
        gameAjax({
            url: "/activity/sevenSignInConfig/save",
            // data: $("#addForm").serialize() + "&awardAllDays=" + JSON.stringify(awardAllDays) + "&configId=" + configId,
            data: $("#addForm").serialize() + "&awardAllDays=" + JSON.stringify(awardAllDays),
            callback: function (data) {
                if(data){
                    swal("操作成功", "", "success");
                }else{
                    swal("操作失败", "未知错误~", "error");
                }
                $("#addModal").modal("hide");
                table.bootstrapTable("refresh");
            }
        });
    }

    function changeStatus(id) {
        gameAjax({
            url: "/activity/signInConfig/changeStatus",
            data: "id=" + id,
            callback: function (data, message) {
                table.bootstrapTable("refresh");
            }
        });
    }

    function del(id) {
        swal({
            title: [[#{sys.confirm.title}]],
            text: [[#{sys.confirm.text}]],
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: [[#{sys.confirm.confirmtext}]],
            cancelButtonText: [[#{sys.confirm.canceltext}]],
            closeOnConfirm: false
        }, function (isConfirm) {
            if (isConfirm) {
                gameAjax({
                    url: "/activity/sevenSignInConfig/delete",
                    data: "configId=" + id,
                    callback: function (data, message) {
                        if(data){
                            swal("删除成功", "", "success");
                        }else{
                            swal("删除失败", "要删除的数据不存在~", "error");
                        }
                        table.bootstrapTable("refresh");
                    }
                });
            }
        })
    }

    var rowNumber = 1;
    var rowNumbers = {};
    var awardTableTe = [];

    function addAwardConf() {
        // var data = {};
        // data["rowNumber"] = rowNumber++;
        // data["curreney"] = "";
        // data["amount"] = "";
        var data = {};
        data["rowNumber"] = rowNumber++;
        data["itemId"] = "";
        data["count"] = "";
        $("#awardTable").bootstrapTable("append", data);
    }
    //回显
    function editView(id , daysAwardsLength){
        // console.log(daysAwardsLength);
        // console.log(id);
        var item = awardTableTe;
        // console.log(item);
        for (var i = 1; i <= daysAwardsLength; i++) {
            loadAwardConfx(id , i-1 , "awardTable"+i+"","awardConfBar"+i+"" , item);
        }
    }
    function addAwardConfx(rowNumber , awardTable) {
        // alert(1);

        // alert(rowNumbers[rowNumber]);
        // alert(awardTable);  //参数传递正常

        var data = {};
        data["rowNumber"] = rowNumbers[rowNumber]++;
        data["itemId"] = "";
        data["count"] = "";
        $("#"+awardTable+"").bootstrapTable("append", data);
        // console.log();
    }

    // 注意：index:从0开始  awardTable:从1开始
    function loadAwardConfx(id , index , awardTable  , awardConfBar  , item) {
        // alert(id);
        // alert(awardConfBar);  //参数传递正确

        var data = '';
        var row = 1;
        if (id != '') {
            // awardTable = 'awardTable1';
            // item = table.bootstrapTable("getRowByUniqueId", id);
            // console.log(item);
            // if(awardTableTe.length !== 0){
            //     item = awardTableTe;
            // }
            var teData = item.daysAwards[parseInt(index)];
            console.log(teData);
            if(item.daysAwards == null) {
                data = "";
            }else{
                data = [];
                $.extend(true , data , teData); //深拷贝
            }
            // data = item.daysAwards == null ? "" : item.daysAwards[parseInt(index)];


            // console.log(data);
            // alert(id);
            for (var i in data) {
                data[i]["rowNumber"] = row++;
                // data[i][rowNumbers["rowNumber"]] = row++;
            }
        }
        $("#"+awardTable+"").bootstrapTable("destroy");
        $("#"+awardTable+"").bootstrapTable({
            data: data,
            idField: "rowNumber",
            uniqueId: "rowNumber",
            toolbar: awardConfBar,
            columns: [
                {
                    title: ['奖励类型'],
                    field: "itemId",
                    align: "center",
                    editable: {
                        type: "select",
                        source: ["gold" , "chip"],
                        title: "奖励类型",
                        disabled: false,
                        validate: function (value) {
                            if (!$.trim(value)) {
                                return "不能为空";
                            }
                        }
                    }
                },
                {
                    title: ['数额'],
                    field: "count",
                    align: "center",
                    editable: {
                        type: "number"
                    }
                },
                {
                    field: "rowNumber",
                    title: [[#{sys.operate}]],
                    align: "center",
                    formatter: function (value, row, index) {
                        // console.log($("#"+awardTable+"").bootstrapTable("getData"));
                        index + 1;
                        return [
                            '<a class="removeuid" href="javascript:void(0)" onclick="deleteAwardx(\'' + value + '\' , \'' + awardTable + '\')" title="Remove">',
                            '<i class="glyphicon glyphicon-remove"></i>',
                            '</a>'
                        ].join('');
                    }
                }
            ]
        });
        // var te = $("#"+awardTable+"").bootstrapTable("getData");
        // if(te.length !== 0){
        //     awardTableTe.push(te);
        // }
        // console.log(awardTableTe);
    }

    function deleteAward(rowNumber) {
        // alert(rowNumber);
        $("#awardTable").bootstrapTable("removeByUniqueId", rowNumber);
    }


    // function deleteAwardxPre(rowNumber , awardTable) {
    //
    //     deleteAwardx(rowNumber , awardTable)
    // }
    function deleteAwardx(rowNumber , awardTable) {
        $("#"+awardTable+"").bootstrapTable("removeByUniqueId", rowNumber);
        console.log(awardTableTe);
    }

    function addOtherAwardConf() {
        var data = {};
        data["rowNumber"] = rowNumber++;
        data["awardId"] = "";
        data["count"] = "";
        $("#otherAwardTable").bootstrapTable("append", data);
    }

    function loadOtherAwardConf(id) {
        var data = '';
        var row = 1;
        if (id != '') {
            var item = table.bootstrapTable("getRowByUniqueId", id);
            data = item.otherAwardConfList == null ? "" : item.otherAwardConfList;
            for (var i in data) {
                data[i]["rowNumber"] = row++;
            }
        }
        $("#otherAwardTable").bootstrapTable("destroy");
        $("#otherAwardTable").bootstrapTable({
            data: data,
            idField: "rowNumber",
            uniqueId: "rowNumber",
            toolbar: "#otherAwardTableBar",
            columns: [
                {
                    title: ['奖励'],
                    field: "awardId",
                    align: "center",
                    editable: {
                        type: "select",
                        source: otherAwardTypes,
                        title: "奖励类型",
                        disabled: false,
                        validate: function (value) {
                            if (!$.trim(value)) {
                                return "不能为空";
                            }
                        }
                    }
                },
                {
                    title: ['数额'],
                    field: "count",
                    align: "center",
                    editable: {
                        type: "number"
                    }
                },
                {
                    field: "rowNumber",
                    title: [[#{sys.operate}]],
                    align: "center",
                    formatter: function (value, row, index) {
                        index + 1;
                        return [
                            '<a class="removeuid" href="javascript:void(0)" onclick="deleteOtherAward(\'' + value + '\')" title="Remove">',
                            '<i class="glyphicon glyphicon-remove"></i>',
                            '</a>'
                        ].join('');
                    }
                }
            ]
        });
    }

    function deleteOtherAward(rowNumber) {
        $("#otherAwardTable").bootstrapTable("removeByUniqueId", rowNumber);
    }


    /*]]>*/
</script>
</html>